<%-- 
    Document   : newEvent
    Created on : May 12, 2011, 9:24:02 PM
    Author     : enriquer
--%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page contentType="text/html" pageEncoding="UTF-8"%>


<div id="divMessage" align="center"></div>
<form dojoType="dijit.form.Form" id="frmEvent" name="frmEvent" action="saveEvent.htm" method="POST">
    <input type="hidden" id="txtStatus" name="txtStatus" value="${params.status}"/>
    <input type="hidden" id="txtEventId" name="txtEventId" value="${params.eventId}"/>
    <table cellspacing="10" align="left">
        <tr>
            <td>
                <label for="txtName"><spring:message code="newevent.name"/></label>
            </td>
            <td>
                <input type="text" id="txtName" name="txtName" dojoType="dijit.form.ValidationTextBox"
                       required="true" trim="true" maxLength="30" regExp="[A-Za-z0-9\s]+" widgetsInTemplate="true"
                       value="${params.name}"
                       invalidMessage="<spring:message code="message.invalid"/>"
                       missingMessage="<spring:message code="message.empty"/>"/>
            </td>
        </tr>
        <tr>
            <td>
                <label for="txtDescription"><spring:message code="newevent.description"/></label>
            </td>
            <td>
                <textarea id="txtDescription" name="txtDescription" dojoType="dijit.form.SimpleTextarea" 
                          trim="true" maxLength="50" rows="4" cols="50" style="width:auto;"
                          value="${params.description}">
                </textarea>
            </td>
        </tr>
        <tr>
            <td>
                <label for="txtStartDate"><spring:message code="newevent.startdate"/></label>
            </td>
            <td>
                <input type="text" id="txtStartDate" name="txtStartDate" required="true" dojoType="dijit.form.DateTextBox"
                       value="${params.startDate}"
                       invalidMessage="<spring:message code="message.invalid"/>"
                       missingMessage="<spring:message code="message.empty"/>"/>
                &nbsp;&nbsp;&nbsp;
                <input type="text" id="txtStartTime" name="txtStartTime" required="true" dojoType="dijit.form.TimeTextBox"
                       displayedValue="${params.startTime}"
                       invalidMessage="<spring:message code="message.invalid"/>"
                       missingMessage="<spring:message code="message.empty"/>"/>
            </td>
        </tr>
        <tr>
            <td>
                <label for="txtEndDate"><spring:message code="newevent.enddate"/></label>
            </td>
            <td>
                <input type="text" id="txtEndDate" name="txtEndDate" required="true" dojoType="dijit.form.DateTextBox"
                       value="${params.endDate}"
                       invalidMessage="<spring:message code="message.invalid"/>"
                       missingMessage="<spring:message code="message.empty"/>"/>
                &nbsp;&nbsp;&nbsp;
                <input type="text" id="txtEndTime" name="txtEndTime" required="true" dojoType="dijit.form.TimeTextBox"
                       displayedValue="${params.endTime}"
                       invalidMessage="<spring:message code="message.invalid"/>"
                       missingMessage="<spring:message code="message.empty"/>"/>
            </td>
        </tr>
        <tr>
            <td>
                <label for="cbxPrivacy"><spring:message code="newevent.privacy"/></label>
            </td>
            <td>
                <input id="cbxPrivacy" name="cbxPrivacy" dojoType="dijit.form.CheckBox" value="1"
                       <c:if test="${params.privacy!=null}"> checked </c:if>>
                </td>
            </tr>
            <tr>
                <td>
                    <label for="txtLimit"><spring:message code="newevent.limit"/></label>
            </td>
            <td>
                <input id="txtLimit" name="txtLimit" dojoType="dijit.form.NumberSpinner" 
                       smallDelta="1" constraints="{min:1,places:0}" 
                       invalidMessage="<spring:message code="message.invalid"/>"
                       value="${params.limit}"/>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <br>
                <button dojoType="dijit.form.Button" type="button" id="btnDraft" name="btnDraft" 
                        onClick="submitSaveEvent(null);">
                    <spring:message code="editevent.save"/>
                </button>
                <!-- solo podemos publicar los eventos en estado DRAFT "0" -->
                <c:if test="${params.status=='0'}">
                    &nbsp;&nbsp;&nbsp;
                    <!-- estado PUBLISH "1" -->
                    <button dojoType="dijit.form.Button" type="button" id="btnPublish" name="btnPublish"
                            onClick="submitSaveEvent('1');">
                        <spring:message code="editevent.publish"/>
                    </button>
                </c:if>
            </td>
        </tr>
    </table>
</form>


